<template>
  <el-col class="info-wrapper" :span="23">
    <el-form
      ref="form"
      :model="searchParams"
      class="search-from main-content"
      label-width="120px"
    >
      <el-col class="search-col">
        <el-form-item label="企业名称" prop="companyName">
          <el-input v-model="searchParams.companyName"></el-input>
        </el-form-item>
        <el-form-item label="证书名称" prop="certificateName">
          <el-input v-model="searchParams.certificateName"></el-input>
        </el-form-item>
        <el-form-item label="起始时间" prop="startTime">
          <el-date-picker
            v-model="searchParams.startTime"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="到期时间" prop="expirationTime">
          <el-date-picker
            v-model="searchParams.expirationTime"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-col class="search-col">
        <el-form-item label="月份搜索" prop="monthSearch">
          <el-select
            v-model="searchParams.monthSearch"
            placeholder="请选择"
          >
            <el-option
              v-for="item in monthSearchList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col class="search-col operation-area">
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">清空</el-button>
      </el-col>
    </el-form>

    <el-tabs class="table-tabs" type="border-card">
      <el-tab-pane>
        <span slot="label">客户信息查询 {{ tableData.length }}</span>
        <el-table border :data="tableData">
          <el-table-column prop="date" label="企业名称"> </el-table-column>
          <el-table-column prop="date" label="证书名称"> </el-table-column>
          <el-table-column prop="date" label="证书起始时间"> </el-table-column>
          <el-table-column prop="date" label="证书到期时间"> </el-table-column>
          <el-table-column prop="date" label="证书备注"> </el-table-column>
          <el-table-column prop="operation" label="操作">
            <el-link type="primary" @click="downloadRow">下载</el-link>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
  </el-col>
</template>

<script>
export default {
  name: "certificateSearch",
  data() {
    return {
      defulatParams: {
        companyName: "", // 企业名称
        certificateName: "", // 证书名称
        startTime: "", // 起始时间
        expirationTime: "", // 到期时间
        monthSearch: "" // 月份搜索
      },
      searchParams: {
        ...this.defulatParams,
      },
      tableData: [{ date: 123 }], // 表格数据
      monthSearchList: [] // 月份搜索列表
    };
  },
  mounted() {
    this.queryTableData();
  },
  methods: {
    search() {
      // todo: 搜索方法
    },
    reset() {
      this.searchParams = {
        ...this.defulatParams
      };
      this.search();
    },
    downloadRow() {
      // todo: 删除接口
      this.search();
    },
    queryTableData() {
      // todo：获取表格数据
    }
  },
};
</script>

<style lang="less" scoped>
.info-wrapper {
  font-family: Source Han Sans CN;
  font-weight: 400;
  height: 100%;

  .search-from {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid #c2d9e6;
    padding-top: 20px;

    .search-col {
      display: flex;
    }

    .operation-area {
      margin-left: 20px;
      margin-bottom: 10px;
    }
  }

  .table-tabs {
    margin-top: 15px;
  }

  .operation-col {
    white-space: 5px;
  }
}
</style>
